<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div id="app">
            <cpn2></cpn2>
        </div>
        <script src="../js/vue.js"></script>
        <script>
            // 子组件
            const cpnC1 = Vue.extend({
                template: `<div>
                    <h1>标题1</h1>
                    <p>内容1</p>
                </div>`
            })

            // 父组件
            const cpnC2 = Vue.extend({
                template: `<div>
                    <h1>标题2</h1>
                    <p>内容2</p>
                    <cpn1></cpn1>   
                </div>`,
                components: {
                    cpn1: cpnC1 //在这里注册了子组件
                }
            })

            // root组件
            const app = new Vue({
                el: '#app',
                data: {
                    message: '你好啊'
                },
                components: {
                    cpn2: cpnC2
                }
            })
        </script>
    </body>
</html>